#include "TestGrammarLexer.h"
#include "TestGrammarListener.h"
#include "TestGrammarParser.h"

#include "visitor/BasicVisitor.h"
#include <tree/ParseTreeWalker.h>

using namespace antlr4;
using namespace std;
using namespace UniAST;
int main(int argc, char **argv) {
	std::ifstream stream;
	stream.open(argv[1]);
	ANTLRInputStream input(stream);
	TestGrammarLexer lexer(&input);
	CommonTokenStream tokens(&lexer);
	TestGrammarParser parser(&tokens);
	auto root = parser.module();
	TestGrammarListener listener(parser.astmap);
	tree::ParseTreeWalker walker;
	walker.walk(&listener, root);
	listener.printStringTree();
	BasicVisitor visitor;
	visitor.visit(listener.getRoot());
	return 0;
	}
